import grails.util.Environment

/**
 * Logging Filters
 *
 * <p>Handle some logging stuffs
 *
 * @since 0.0.1
 * @author <a href="mailto:matafe@gmail.com">Maurício T. Ferraz</a>
 */
class LoggingFilters {

    def filters = {
        all(controller:'*', action:'*') {
            before = {
                switch(Environment.current) {
                    case Environment.DEVELOPMENT:
                    log.debug "Parameters: ${params.inspect()}"
                    break
                }
            }
            after = { model ->
                switch(Environment.current) {
                    case Environment.DEVELOPMENT:
                    log.debug "Model: ${model?.inspect()}"
                    break
                }
            }
            afterView = {
                
            }
        }
    }
    
}
